package com.sh.threadmethod.daemonthread;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class DaemonThread {
    public static void main(String[] args) {
        God god = new God();
        You you = new You();
        Thread godThread = new Thread(god);
        Thread youThread = new Thread(you);
        godThread.setDaemon(true);
        godThread.start();
        youThread.start();

    }
}


class God implements Runnable {
    @Override
    public void run() {
        while (true) {
            System.out.println("上帝在看着你");
        }
    }
}


// 你
class You implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 36500; i++) {
            System.out.println("我活了" + i);
        }
        System.out.println("我死了");
    }
}

